this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(t,e,n){"use strict";var i={id:n.Text.getRandom(),text:"",html:"",onClick:function t(){},attrs:{},disabled:false,className:null};var a,s;function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function r(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){babelHelpers.defineProperty(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var l=function(t){babelHelpers.inherits(e,t);function e(t,a){var s;babelHelpers.classCallCheck(this,e);s=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(e).call(this));s.setEventNamespace("BX.Landing.UI.Button.BaseButton");var o=function(){if(n.Type.isPlainObject(a)){return a}if(n.Type.isPlainObject(t)){return t}return{}}();var l=function(){if(n.Type.isStringFilled(t)){return t}if(n.Type.isStringFilled(o.id)){return o.id}return n.Text.getRandom()}();s.options=r(r({},i),o);s.id=l;s.cache=new n.Cache.MemoryCache;s.layout=s.getLayout();if(n.Type.isStringFilled(s.options.html)){s.setHtml(s.options.html)}else{s.setText(s.options.text)}if(n.Type.isFunction(s.options.onClick)){n.Event.bind(s.getLayout(),"click",s.options.onClick)}if(n.Type.isPlainObject(s.options.attrs)){n.Dom.attr(s.getLayout(),s.options.attrs)}if(n.Type.isArray(s.options.className)||n.Type.isStringFilled(s.options.className)){n.Dom.addClass(s.layout,s.options.className)}if(s.options.active){s.activate()}if(s.options.disabled){s.disable()}n.Event.bind(s.getLayout(),"click",(function(t){t.preventDefault();s.emit("onClick")}));return s}babelHelpers.createClass(e,[{key:"getLayout",value:function t(){var e=this;return this.cache.remember("layout",(function(){return n.Tag.render(a||(a=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<button \n\t\t\t\t\tclass="landing-ui-button" \n\t\t\t\t\ttype="button"\n\t\t\t\t\tdata-id="','"\n\t\t\t\t>',"</button>\n\t\t\t"])),e.id,e.getTextLayout())}))}},{key:"getTextLayout",value:function t(){return this.cache.remember("textLayout",(function(){return n.Tag.render(s||(s=babelHelpers.taggedTemplateLiteral(['<span class="landing-ui-button-text"></span>'])))}))}},{key:"setHtml",value:function t(e){this.getTextLayout().innerHTML=e}},{key:"setText",value:function t(e){this.getTextLayout().innerHTML=n.Text.encode(e)}},{key:"on",value:function t(e,i,a){if(n.Type.isString(e)&&n.Type.isFunction(i)){n.Event.bind(this.layout,e,BX.proxy(i,a))}}},{key:"setAttributes",value:function t(e){n.Dom.attr(this.layout,e)}},{key:"setAttribute",value:function t(e,i){n.Dom.attr(this.layout,e,i)}},{key:"disable",value:function t(){n.Dom.addClass(this.layout,"landing-ui-disabled")}},{key:"enable",value:function t(){n.Dom.removeClass(this.layout,"landing-ui-disabled");n.Dom.attr(this.layout,"disabled",null)}},{key:"isEnabled",value:function t(){return!n.Dom.hasClass(this.layout,"landing-ui-disabled")}},{key:"show",value:function t(){return BX.Landing.Utils.show(this.layout)}},{key:"hide",value:function t(){return BX.Landing.Utils.hide(this.layout)}},{key:"activate",value:function t(){n.Dom.addClass(this.layout,"landing-ui-active")}},{key:"deactivate",value:function t(){n.Dom.removeClass(this.layout,"landing-ui-active")}},{key:"isActive",value:function t(){return n.Dom.hasClass(this.layout,"landing-ui-active")}}]);return e}(e.EventEmitter);t.BaseButton=l})(this.BX.Landing.UI.Button=this.BX.Landing.UI.Button||{},BX.Event,BX);
//# sourceMappingURL=basebutton.bundle.map.js